package version_local

import (
    "github.com/go-admin-team/go-admin-core/sdk/pkg"
    "gorm.io/gorm"
    "runtime"

    "go-admin/cmd/migrate/migration"
    common "go-admin/common/models"
)

func init() {
    _, fileName, _, _ := runtime.Caller(0)
    migration.Migrate.SetVersion(migration.GetFilename(fileName), _1737090831831Test)
}

func _1737090831831Test(db *gorm.DB, version string) error {
    return db.Transaction(func(tx *gorm.DB) error {

        timeNow := pkg.GetCurrentTime()
        Mmenu := Menu{}
        Mmenu.MenuName = "ht_projectManage"
        Mmenu.Title = "项目管理"
        Mmenu.Icon = "pass"
        Mmenu.Path = "/ht_project"
        Mmenu.MenuType = "M"
        Mmenu.Action = "无"
        Mmenu.ParentId = 0
        Mmenu.NoCache = false
        Mmenu.Component = "Layout"
        Mmenu.Sort = 0
        Mmenu.Visible = "0"
        Mmenu.IsFrame = "0"
        Mmenu.CreateBy = "1"
        Mmenu.UpdateBy = "1"
        Mmenu.CreatedAt = timeNow
        Mmenu.UpdatedAt = timeNow
        // Mmenu.MenuId, err = Mmenu.Create(db)
        err := tx.Create(&Mmenu).Error
        if err != nil {
            return err
        }
        Cmenu := Menu{}
        Cmenu.MenuName = "ht_project"
        Cmenu.Title = "项目管理"
        Cmenu.Icon = "pass"
        Cmenu.Path = "/hunter/ht_project"
        Cmenu.MenuType = "C"
        Cmenu.Action = "无"
        Cmenu.Permission = "hunter:htProject:list"
        Cmenu.ParentId = Mmenu.MenuId
        Cmenu.NoCache = false
        Cmenu.Component = "/hunter/ht-project/index"
        Cmenu.Sort = 0
        Cmenu.Visible = "0"
        Cmenu.IsFrame = "0"
        Cmenu.CreateBy = "1"
        Cmenu.UpdateBy = "1"
        Cmenu.CreatedAt = timeNow
        Cmenu.UpdatedAt = timeNow
        // Cmenu.MenuId, err = Cmenu.Create(db)
        err = tx.Create(&Cmenu).Error
        if err != nil {
            return err
        }

        MList := Menu{}
        MList.MenuName = ""
        MList.Title = "分页获取HtProject"
        MList.Icon = ""
        MList.Path = "ht_project"
        MList.MenuType = "F"
        MList.Action = "无"
        MList.Permission = "hunter:htProject:query"
        MList.ParentId = Cmenu.MenuId
        MList.NoCache = false
        MList.Sort = 0
        MList.Visible = "0"
        MList.IsFrame = "0"
        MList.CreateBy = "1"
        MList.UpdateBy = "1"
        MList.CreatedAt = timeNow
        MList.UpdatedAt = timeNow
        // MList.MenuId, err = MList.Create(db)
        err = tx.Create(&MList).Error
        if err != nil {
            return err
        }

        MCreate := Menu{}
        MCreate.MenuName = ""
        MCreate.Title = "创建HtProject"
        MCreate.Icon = ""
        MCreate.Path = "ht_project"
        MCreate.MenuType = "F"
        MCreate.Action = "无"
        MCreate.Permission = "hunter:htProject:add"
        MCreate.ParentId = Cmenu.MenuId
        MCreate.NoCache = false
        MCreate.Sort = 0
        MCreate.Visible = "0"
        MCreate.IsFrame = "0"
        MCreate.CreateBy = "1"
        MCreate.UpdateBy = "1"
        MCreate.CreatedAt = timeNow
        MCreate.UpdatedAt = timeNow
        // MCreate.MenuId, err = MCreate.Create(db)
        err = tx.Create(&MCreate).Error
        if err != nil {
            return err
        }

        MUpdate := Menu{}
        MUpdate.MenuName = ""
        MUpdate.Title = "修改HtProject"
        MUpdate.Icon = ""
        MUpdate.Path = "ht_project"
        MUpdate.MenuType = "F"
        MUpdate.Action = "无"
        MUpdate.Permission = "hunter:htProject:edit"
        MUpdate.ParentId = Cmenu.MenuId
        MUpdate.NoCache = false
        MUpdate.Sort = 0
        MUpdate.Visible = "0"
        MUpdate.IsFrame = "0"
        MUpdate.CreateBy = "1"
        MUpdate.UpdateBy = "1"
        MUpdate.CreatedAt = timeNow
        MUpdate.UpdatedAt = timeNow
        // MUpdate.MenuId, err = MUpdate.Create(db)
        err = tx.Create(&MUpdate).Error
        if err != nil {
            return err
        }

        MDelete := Menu{}
        MDelete.MenuName = ""
        MDelete.Title = "删除HtProject"
        MDelete.Icon = ""
        MDelete.Path = "ht_project"
        MDelete.MenuType = "F"
        MDelete.Action = "无"
        MDelete.Permission = "hunter:htProject:remove"
        MDelete.ParentId = Cmenu.MenuId
        MDelete.NoCache = false
        MDelete.Sort = 0
        MDelete.Visible = "0"
        MDelete.IsFrame = "0"
        MDelete.CreateBy = "1"
        MDelete.UpdateBy = "1"
        MDelete.CreatedAt = timeNow
        MDelete.UpdatedAt = timeNow
        // MDelete.MenuId, err = MDelete.Create(db)
        err = tx.Create(&MDelete).Error
        if err != nil {
            return err
        }

        var InterfaceId = 63
        Amenu := Menu{}
        Amenu.MenuName = "ht_project"
        Amenu.Title = "HtProject"
        Amenu.Icon = "bug"
        Amenu.Path = "ht_project"
        Amenu.MenuType = "M"
        Amenu.Action = "无"
        Amenu.ParentId = InterfaceId
        Amenu.NoCache = false
        Amenu.Sort = 0
        Amenu.Visible = "1"
        Amenu.IsFrame = "0"
        Amenu.CreateBy = "1"
        Amenu.UpdateBy = "1"
        Amenu.CreatedAt = timeNow
        Amenu.UpdatedAt = timeNow
        // Amenu.MenuId, err = Amenu.Create(db)
        err = tx.Create(&Amenu).Error
        if err != nil {
            return err
        }

        AList := Menu{}
        AList.MenuName = ""
        AList.Title = "分页获取HtProject"
        AList.Icon = "bug"
        AList.Path = "/api/v1/ht-project"
        AList.MenuType = "A"
        AList.Action = "GET"
        AList.ParentId = Amenu.MenuId
        AList.NoCache = false
        AList.Sort = 0
        AList.Visible = "1"
        AList.IsFrame = "0"
        AList.CreateBy = "1"
        AList.UpdateBy = "1"
        AList.CreatedAt = timeNow
        AList.UpdatedAt = timeNow
        // AList.MenuId, err = AList.Create(db)
        err = tx.Create(&AList).Error
        if err != nil {
            return err
        }

        AGet := Menu{}
        AGet.MenuName = ""
        AGet.Title = "根据id获取HtProject"
        AGet.Icon = "bug"
        AGet.Path = "/api/v1/ht-project/:id"
        AGet.MenuType = "A"
        AGet.Action = "GET"
        AGet.ParentId = Amenu.MenuId
        AGet.NoCache = false
        AGet.Sort = 0
        AGet.Visible = "1"
        AGet.IsFrame = "0"
        AGet.CreateBy = "1"
        AGet.UpdateBy = "1"
        AGet.CreatedAt = timeNow
        AGet.UpdatedAt = timeNow
        // AGet.MenuId, err = AGet.Create(db)
        err = tx.Create(&AGet).Error
        if err != nil {
            return err
        }

        ACreate := Menu{}
        ACreate.MenuName = ""
        ACreate.Title = "创建HtProject"
        ACreate.Icon = "bug"
        ACreate.Path = "/api/v1/ht-project"
        ACreate.MenuType = "A"
        ACreate.Action = "POST"
        ACreate.ParentId = Amenu.MenuId
        ACreate.NoCache = false
        ACreate.Sort = 0
        ACreate.Visible = "1"
        ACreate.IsFrame = "0"
        ACreate.CreateBy = "1"
        ACreate.UpdateBy = "1"
        ACreate.CreatedAt = timeNow
        ACreate.UpdatedAt = timeNow
        // ACreate.MenuId, err = ACreate.Create(db)
        err = tx.Create(&ACreate).Error
        if err != nil {
            return err
        }

        AUpdate := Menu{}
        AUpdate.MenuName = ""
        AUpdate.Title = "修改HtProject"
        AUpdate.Icon = "bug"
        AUpdate.Path = "/api/v1/ht-project/:id"
        AUpdate.MenuType = "A"
        AUpdate.Action = "PUT"
        AUpdate.ParentId = Amenu.MenuId
        AUpdate.NoCache = false
        AUpdate.Sort = 0
        AUpdate.Visible = "1"
        AUpdate.IsFrame = "0"
        AUpdate.CreateBy = "1"
        AUpdate.UpdateBy = "1"
        AUpdate.CreatedAt = timeNow
        AUpdate.UpdatedAt = timeNow
        // AUpdate.MenuId, err = AUpdate.Create(db)
        err = tx.Create(&AUpdate).Error
        if err != nil {
            return err
        }

        ADelete := Menu{}
        ADelete.MenuName = ""
        ADelete.Title = "删除HtProject"
        ADelete.Icon = "bug"
        ADelete.Path = "/api/v1/ht-project"
        ADelete.MenuType = "A"
        ADelete.Action = "DELETE"
        ADelete.ParentId = Amenu.MenuId
        ADelete.NoCache = false
        ADelete.Sort = 0
        ADelete.Visible = "1"
        ADelete.IsFrame = "0"
        ADelete.CreateBy = "1"
        ADelete.UpdateBy = "1"
        ADelete.CreatedAt = timeNow
        ADelete.UpdatedAt = timeNow
        //ADelete.MenuId, err = ADelete.Create(db)
        err = tx.Create(&ADelete).Error
        if err != nil {
            return err
        }

        CTmenu := Menu{}
        CTmenu.MenuName = "ht_project"
        CTmenu.Title = "项目人才"
        CTmenu.Icon = "pass"
        CTmenu.Path = "/hunter/ht_project/talent"
        CTmenu.MenuType = "C"
        CTmenu.Action = "无"
        CTmenu.Permission = "hunter:htProject:list"
        CTmenu.ParentId = Mmenu.MenuId
        CTmenu.NoCache = false
        CTmenu.Component = "/hunter/ht-project/talent/index"
        CTmenu.Sort = 0
        CTmenu.Visible = "0"
        CTmenu.IsFrame = "1"
        CTmenu.CreateBy = "1"
        CTmenu.UpdateBy = "1"
        CTmenu.CreatedAt = timeNow
        CTmenu.UpdatedAt = timeNow
        // CTmenu.MenuId, err = Cmenu.Create(db)
        err = tx.Create(&CTmenu).Error
        if err != nil {
            return err
        }

        return tx.Create(&common.Migration{
            Version: version,
        }).Error
    })
}
